from mod_verbs import Verb
import mod_item,mod_gui

class Whack(Verb):
    def __init__(self,power):
        Verb.__init__(self,'WHACK','BUTTON_SHOOT',3,'dir')
        self.power = power
    
    def doIt(self,actor,item,dir):
        actor.useAP(self.AP)
        level,coords = actor.location
        targetCoords = (coords[0]+dir.xOffset,coords[1]+dir.yOffset)
        otherEntity = level.entityMap.get(targetCoords)
        if otherEntity:
            mod_gui.theGUI.messages.append(actor.glyph+' WHACKS '+otherEntity.glyph+'.')
            otherEntity.takeDamage(self.power,'blunt')

vibroswordPrototype = mod_item.ItemPrototype('VIBROSWORD',grabbable=True)
vibroswordPrototype.verbs.append(Whack(4))